package com.czk.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.czk.mapper.BlogMapper;
import com.czk.pojo.Blog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/6/23 16:08
 */
@RestController
@RequestMapping("/blog")
public class BlogController {
    @Autowired
    private BlogMapper blogMapper;
    @GetMapping("/all")
    public List<Blog> selectAll(){
        QueryWrapper<Blog> wrapper=new QueryWrapper();
        wrapper.eq("id",1);
        Blog blog = blogMapper.selectOne(wrapper);
        List<Blog> list=new ArrayList<>();
        list.add(blog);
        return list;
    }
}
